package icu.twtool.ui.component

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.onClick
import androidx.compose.material.Button
import androidx.compose.material.LocalContentColor
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.pointer.pointerHoverIcon
import androidx.compose.ui.unit.dp
import icu.twtool.ui.style.MyColors
import icu.twtool.ui.style.MyCursor

/**
 * 主要的按钮
 */
@Composable
@Suppress("FunctionName")
fun PrimaryButton(text: String, modifier: Modifier = Modifier, onClick: () -> Unit) {
    Button(onClick, colors = MyColors.ButtonPrimary(), modifier = modifier.pointerHoverIcon(MyCursor.HandCursor)) {
        Text(text)
    }
}

/**
 * 错误文本按钮
 */
@Composable
@Suppress("FunctionName")
@OptIn(ExperimentalFoundationApi::class)
fun InfoTextButton(text: String, modifier: Modifier = Modifier, onClick: () -> Unit) {
    Text(text, color = LocalContentColor.current, modifier = modifier.padding(8.dp).pointerHoverIcon(MyCursor.HandCursor).onClick { onClick() })
}

/**
 * 错误文本按钮
 */
@Composable
@Suppress("FunctionName")
@OptIn(ExperimentalFoundationApi::class)
fun ErrorTextButton(text: String, modifier: Modifier = Modifier, onClick: () -> Unit) {
    Text(text, color = MyColors.Error, modifier = modifier.padding(8.dp).pointerHoverIcon(MyCursor.HandCursor).onClick { onClick() })
}

/**
 * 文本按钮
 */
@Composable
@Suppress("FunctionName")
@OptIn(ExperimentalFoundationApi::class)
fun TertiaryTextButton(text: String, modifier: Modifier = Modifier, onClick: () -> Unit) {
    Text(text, color = MyColors.Tertiary, modifier = modifier.padding(8.dp).pointerHoverIcon(MyCursor.HandCursor).onClick { onClick() })
}